<template>
	<view class="pay-success">
		<view class="head">
			<view class="head-title">
				<view>
					<text style="font-size: 32upx;" class="iconfont icon-check-circle"></text>
				<text class="fz18">恭喜您，订单支付成功</text>
				</view>
				<view>
					<text>可在 我的 - {{type == '0' ? '门票':type == '1' ? '酒店':type == '2' ? '线路':'购物'}}订单 中查看信息</text>
				</view>
			</view>
		</view>
		<view class="content">
				<view>
					<text style="line-height:40upx; color: #666;">一部手机游甘肃会根据您的付款方式进行订单全款扣除和预授权限定，如订单不确认将解除预授权或全额退款至您的付款账户。</text>
				</view>
				<view style="margin-top: 20upx;">
					<text>订单是否生效以一部手机游甘肃最终确认为准。</text>
				</view>
		</view>
		
		<view class="foot">
				<view @click="goDetail()" v-if="length != '0'">
					<text>订单详情</text>
				</view>
				<view @click="backToIndex()">
					<text>返回首页</text>
				</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				order_id:'',
				order_list:[],
				length:'0',
				type:''
			};
		},
		onLoad(option){
			console.log("传过来的参数--------->",option.item);
			this.order_id = option.item;
			this.type = option.type;
			// this.order_id = "1562581691382780";
			// if(this.type != 3) {
			// 	this.getOrderDetail();
			// }
		},
		methods:{
			getOrderDetail(){
				let account = this.pub.getAccount();
				uni.showLoading({
					title: '加载中'
				});
				// let account = "oqA-m5JVdaxXPSf08Ovdc1DPHOAE";
				this.$postApi(this.$path.GETSCENICSPOT_ORDERLIST, {
						page: 1,
						rows: 1,
						parentId: this.order_id,
						unionId: account,
						type: this.type
				}).then(data => {
					console.log("订单返回参数-------->", data.data);
					uni.hideLoading();
					if (data.data.success) {
						if (data.data.rows.length !== 0) {
							this.order_list = data.data.rows;
							this.length = '1';
						}
					}
				})	
			},
			goDetail(){
				console.log("type:",this.type);
				uni.setStorage({
					key:'order_detail',
					data:this.order_list[0]
				});
				 
				console.log("this.order_list------------->",this.order_list[0]);
				// uni.reLaunch({
				// 	url:'/pages/order/neworderdetail?type=' + this.type + "&isPaySuc=1"
				// })
				uni.redirectTo({
					url:'/pages/order/neworderdetail?type=' + this.type + "&isPaySuc=1&orderid="+this.order_id
				})
			},
			backToIndex(){
				console.log("type:",this.type);
				//这里直接退到最顶层
				// let delta = 3;
				let delta = 10;
				uni.navigateBack({
					delta:delta
				})
				// uni.navigateTo({
				// 	url:'/pages/order/minepage'
				// })
			}
		}
	}
</script>

<style lang="scss">
	
	.pay-success{
		font-size: 26upx;
		background:#f5f5f5;
		// padding: 10upx;
		/* #ifdef H5 */
		// height: 100%;
		/* #endif */
		.head{
			padding: 30upx;
			background: #fff;
			text-align: center;
			border-bottom: 1upx solid #eee;
			.head-title{
				display: flex;
			flex-direction: column;
			justify-content: center;
				color: dodgerblue;
				font-size: 30upx;
			}
		}
		.content{
			padding: 30upx;
			background: #fff;
			border-bottom: 1upx solid #eee;
		}
		.foot{
			padding: 20upx;
			background: #fff;
			display: flex;
			flex-direction: row;
			justify-content: flex-end;
			view{
				width: 200upx;
				border-radius: 8upx;
				border: 1upx solid #ccc;
				line-height: 50upx;
				margin-left: 20upx;
				text-align: center;
			}
		}
	}
</style>
